﻿using System.Text;
using RAP.Framework.Libary.DomTemplateBuilder.Element.Cache;
using RAP.Framework.Libary.DomTemplateBuilder.Interface;

namespace RAP.Framework.Libary.DomTemplateBuilder.Handler.Cache
{
	/// <summary>
	/// 获取指定键的缓存保存到指定属性中
	/// </summary>
	public class CacheHandlerBase : PropertyElementHandler
	{
		public override string GetFieldName ( object rootParamObject, object parentParamObject, ITemplateRenderContext context )
		{
            Element.Cache.CacheKey cacheKeyEle = ( this.Element as CacheElementBase ).CacheKey;
			var sbCacheKey = new StringBuilder ( );
			cacheKeyEle.Handler.DoRender ( sbCacheKey, rootParamObject, parentParamObject, context );
			return sbCacheKey.ToString ( );
		}
	}
}
